<p-dialog [(visible)]="display" modal="modal"  [responsive]="true" [width]="800" (onHide)="closeMaterialMask(false)">
  <p-header>
    {{title}}
  </p-header>
  <div class="ui-g">
    <div class="ui-g-12">
      <div class="file-box">
        <!--<form class="form-horizontal" [formGroup]="addCycle">-->
        <form class="form-horizontal" [formGroup]="materialForm"  >
          <div class="form-group" >
            <label  class="col-sm-2 control-label"><span>*</span>物品编号:</label>
            <div class="col-sm-4">
              <input type="text" formControlName="pn"   name="pn" class="form-control" [(ngModel)]="submitData.pn" *ngIf="state ==='add'"   >
              <input type="text" formControlName="pn" name="pn" class="form-control" [(ngModel)]="currentMeterial.pn" *ngIf="state ==='update'" readonly>
              <div class="ui-message ui-messages-error ui-corner-all"  *ngIf="!materialForm.controls['pn'].valid&&(!materialForm.controls['pn'].untouched)" >
                <i class="fa fa-close"></i>
                物品编号必填
              </div>
            </div>
            <label  class="col-sm-2 control-label"><span>*</span>物品名称:</label>
            <div class="col-sm-4">
              <input type="text"  formControlName="name" name="reportTypewq" class="form-control" [(ngModel)]="submitData.name" *ngIf="state ==='add'" >
              <input type="text"  formControlName="name" name="reportTypewq" class="form-control" [(ngModel)]="currentMeterial.name" *ngIf="state ==='update'" >
              <div class="ui-message ui-messages-error ui-corner-all"  *ngIf="!materialForm.controls['name'].valid&&(!materialForm.controls['name'].untouched)" >
                <i class="fa fa-close"></i>
                物品名称必填
              </div>
            </div>
          </div>
          <div class="form-group">
            <label  class="col-sm-2 control-label"><span></span>分类:</label>
            <div class="col-sm-4 ui-fluid">
              <p-dropdown [autoWidth]="false" formControlName="catagory" [options]="categories"  name="fenlei" [(ngModel)]="submitData.catagory" *ngIf="state ==='add'"></p-dropdown>
              <p-dropdown [autoWidth]="false" formControlName="catagory" [options]="categories"  name="fenlei" [(ngModel)]="currentMeterial.catagory" *ngIf="state ==='update'" ></p-dropdown>
              <div class="ui-message ui-messages-error ui-corner-all"  *ngIf="!materialForm.controls['catagory'].valid&&(!materialForm.controls['catagory'].untouched)" >
                <i class="fa fa-close"></i>
                分类必填
              </div>
            </div>
            <label  class="col-sm-2 control-label"><span>*</span>供应商:</label>
            <!--supplier-->
            <div class="col-sm-4 ui-fluid">
              <input type="text" formControlName="supplier" name="supplier" class="form-control" [(ngModel)]="submitData.supplier" *ngIf="state ==='add'" >
              <input type="text" formControlName="supplier" name="supplier" class="form-control" [(ngModel)]="currentMeterial.supplier"  *ngIf="state ==='update'">
              <div class="ui-message ui-messages-error ui-corner-all"  *ngIf="!materialForm.controls['supplier'].valid&&(!materialForm.controls['supplier'].untouched)" >
                <i class="fa fa-close"></i>
                供应商必填
              </div>
            </div>
          </div>
          <div class="form-group" >
            <label  class="col-sm-2 control-label"><span>*</span>品牌:</label>
            <div class="col-sm-4">
              <input type="text" formControlName="brand" name="reportTypew" class="form-control" [(ngModel)]="submitData.brand"  *ngIf="state ==='add'">
              <input type="text" formControlName="brand" name="reportTypew" class="form-control" [(ngModel)]="currentMeterial.brand" *ngIf="state ==='update'" >
              <div class="ui-message ui-messages-error ui-corner-all"  *ngIf="!materialForm.controls['brand'].valid&&(!materialForm.controls['brand'].untouched)" >
                <i class="fa fa-close"></i>
                品牌必填
              </div>
            </div>
            <label  class="col-sm-2 control-label"><span>*</span>型号:</label>
            <div class="col-sm-4">
              <input type="text" formControlName="model" name="reportType1" class="form-control"  [(ngModel)]="submitData.model" *ngIf="state ==='add'"  >
              <input type="text" formControlName="model" name="reportType1" class="form-control"  [(ngModel)]="currentMeterial.model" *ngIf="state ==='update'" >
              <div class="ui-message ui-messages-error ui-corner-all"  *ngIf="!materialForm.controls['model'].valid&&(!materialForm.controls['model'].untouched)" >
                <i class="fa fa-close"></i>
                型号必填
              </div>
            </div>
          </div>
          <div class="form-group" >
            <label  class="col-sm-2 control-label">规格:</label>
            <div class="col-sm-4 ui-fluid">
              <p-dropdown formControlName="specification" [autoWidth]="false" [options]="norms" name="guige"  [(ngModel)]="submitData.specification" class="inspection" *ngIf="state ==='add'"></p-dropdown>
              <p-dropdown formControlName="specification" [autoWidth]="false" [options]="norms" name="guige"  [(ngModel)]="currentMeterial.specification" class="inspection" *ngIf="state ==='update'"></p-dropdown>
            </div>
            <label  class="col-sm-2 control-label"><span>*</span>状态:</label>
            <div class="col-sm-4 ui-fluid">
              <p-radioButton formControlName="status" name="group" value="启用" label="启用"  inputId="preopt3" [(ngModel)]="submitData.status" *ngIf="state ==='add'"></p-radioButton>
              <p-radioButton formControlName="status" name="group" value="冻结" label="冻结"  inputId="preopt4" [(ngModel)]="submitData.status" *ngIf="state ==='add'"></p-radioButton>
              <p-radioButton formControlName="status" name="group" value="启用" label="启用"  inputId="preopt3" [(ngModel)]="currentMeterial.status" *ngIf="state ==='update'"></p-radioButton>
              <p-radioButton formControlName="status" name="group" value="冻结" label="冻结"  inputId="preopt4" [(ngModel)]="currentMeterial.status" *ngIf="state ==='update'"></p-radioButton>
            </div>
          </div>
          <div class="form-group" >
            <label  class="col-sm-2 control-label"><span>*</span>安全库存:</label>
            <div class="col-sm-4 ui-fluid">
              <p-dropdown [autoWidth]="false" formControlName="threshold_group" [options]="threshold_group"   [(ngModel)]="submitData.threshold_group" *ngIf="state ==='add'"></p-dropdown>
              <p-dropdown [autoWidth]="false" formControlName="threshold_group" [options]="threshold_group"   [(ngModel)]="currentMeterial.threshold_group" *ngIf="state ==='update'"></p-dropdown>
              <div class="ui-message ui-messages-error ui-corner-all"  *ngIf="!materialForm.controls['threshold_group'].valid&&(!materialForm.controls['threshold_group'].untouched)" >
                <i class="fa fa-close"></i>
                库存阈值分组必填
              </div>
            </div>

          </div>
        </form>
      </div>
    </div>
  </div>
  <p-footer>
    <button type="button" pButton icon="fa-check" label="确定"  [disabled]="!materialForm.valid" (click)="formSubmit(false)"></button>
    <button type="button" pButton icon="fa-close"  label="取消" (click)="closeMaterialMask(false)"></button>
  </p-footer>
</p-dialog>
